package com.hjxr.quota.datasource.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hjxr.quota.datasource.domain.TablenameAlias;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 数据表别名表访问层
 * @author sun
 * @version v1.0
 * @since 2020-08-16
 */
@Mapper
public interface TablenameAliasMapper extends BaseMapper<TablenameAlias> {
    int update(TablenameAlias tableNameAlias);

    /**
     * 获取所有未被删除的资源ID
     * @param datasourceId 资源ID
     * @return
     */
    List<TablenameAlias> selectByDatasourceId(Integer datasourceId);

    /**
     * 获取启用状态（）的TablenameAlias表记录
     * @param datasourceId 资源ID
     * @return
     */
    List<TablenameAlias> selectEnableByDatasourceId(Integer datasourceId);

    TablenameAlias selectByTablename(@Param("tableName") String tableName, @Param("datasourceId") Integer datasourceId);
}
